#include <stdio.h> //for printf
#include <stdlib.h> //for exit
#include "queue.h"

int main() {
    queue_t queueB;

    if (init(&queueB, 100) == QUEUE_FAIL) {
        printf("initial queue error\n");
        exit(1);
    }

    printf("test init function\n");
    printf("queueB.size = %d\n", queueB.size);
    printf("queueB.capacity = %d\n", queueB.capacity);

    //enqueue
    for (int i = 100; i<110; i=i+2) {
        if (enqueue(&queueB, i) != QUEUE_OK) {
            printf("enqueue error %d\n", i);
        }
        printf("add %d into queue\n", i);
    }

    printf("100 in queue = %d, 200 in queue=%d\n", isExist(&queueB,100), isExist(&queueB, 200));

    //dequeue

    while(!isEmpty(&queueB)) {
        int x;
        if (dequeue(&queueB, &x)!= QUEUE_OK) {
            printf("dequeue error\n");
        } else {
            printf("dequeue %d from queue\n", x);
        }
    }

}